<template>
  <span>{{text}}</span>
</template>

<script>
import { mapGetters } from "vuex";

export default {
  name: "housingType",
  inheritAttrs: false,
  props: {
    wareHousingType: {
      type: Number | String,
      default: null
    }
  },
  computed: {
    ...mapGetters(["wareHousingTypes"]),
    text() {
      let res = "";
      if(this.wareHousingType) {
        res = this.wareHousingMap[Number(this.wareHousingType)];
      }
      return res;
    }
  },
  data() {
    return { 
      wareHousingMap: {}
    }
  },
  created() {
    this.wareHousingTypes.forEach(item => {
      this.$set(this.wareHousingMap, item.id, item.text);
    });
  }
}
</script>